package com.sss.gsb.orm.model;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name="GSB_WS_CUSTOMER")
public class Customer implements Serializable {
	
	@Transient
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Transient
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Customer other = (Customer) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 7955631503547277243L;

	@Id @Column(name="CIF")
	private BigDecimal id;
	
	@Column(name="HTEACH")
	private String hTaech;
	
	@Column(name="HMEM")
	private String hMem;
	
	@Column(name="C_TYPE",length=3)
	private String type;
	
	@Column(name="C_TITLE")
	private String title;
	
	@Column(name="C_NAME")
	private String name;
	
	@Column(name="C_SNAME")
	private String surname;
	
	@Column(name="CIZID")
	private String idcard;
	
	@Embedded private RecordInfo recordInfo;

	public BigDecimal getId() {
		return id;
	}

	public void setId(BigDecimal id) {
		this.id = id;
	}

	public String gethTaech() {
		return hTaech;
	}

	public void sethTaech(String hTaech) {
		this.hTaech = hTaech;
	}

	public String gethMem() {
		return hMem;
	}

	public void sethMem(String hMem) {
		this.hMem = hMem;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getName() {
		return (name ==  null)?"":name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return (surname == null)?"":surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getIdcard() {
		return idcard;
	}

	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}

	public RecordInfo getRecordInfo() {
		return recordInfo;
	}

	public void setRecordInfo(RecordInfo recordInfo) {
		this.recordInfo = recordInfo;
	}
	
	@Transient
	public String getFullname(){
		return this.getName().concat(" ").concat(this.getSurname());
	}
	
}
